package com.project.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.project.domain.bo.BizProjectCooperationUnitBo;
import com.project.domain.entity.BizProjectCooperationUnit;
import com.project.domain.vo.ProjectCooperationUnitInfoVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ProjectUnitMapper extends BaseMapper<BizProjectCooperationUnit> {

    /**
     * 获取合作单位列表
     * @param unitBo
     * @return
     */
    @Select({
            "<script>",
            "select bzpcu.*,ps1.name as unitTypeName from biz_project_cooperation_unit bzpcu ",
            "left join (select * from CFG_CATEGORY_ENTRY where CATEGORYID = '${unitBo.cooUnitCategoryId}') ps1 on ps1.code = bzpcu.UNIT_TYPE ",
//            "left join (select * from CFG_CATEGORY_ENTRY where CATEGORYID = '${memBo.degreeCategoryId}') ps2 on ps2.code = vpm.EDU_DEGREE_ID ",
//            "left join (select * from CFG_CATEGORY_ENTRY where CATEGORYID = '${memBo.bearTypeCategoryId}') ps3 on ps3.code = vpm.BEAR_TYPE_ID ",
//            "left join dm_title_define dtd on dtd.SRMS_ID = vpm.TITLE_ID ",
            "where 1=1 ",
//            "<if test='memBo.personName != null and memBo.personName != \"\"'>",
//            "and vpm.PERSON_NAME like CONCAT('%', CAST(#{memBo.personName} AS CHAR), '%') ",
//            "</if>",
            "<if test='unitBo.projectId != null and unitBo.projectId != \"\"'>",
            "and bzpcu.PROJECT_ID = '${unitBo.projectId}' ",
            "</if>",
            "</script>"
    })
    List<ProjectCooperationUnitInfoVo> getUnitList(@Param("unitBo") BizProjectCooperationUnitBo unitBo);
}
